package com.atstudy.headline.web.admin.controller.statistics;

import com.atstudy.headline.entity.AdPerformanceDaily;
import com.atstudy.headline.result.Result;
import com.atstudy.headline.web.admin.service.AdAudienceStatsService;
import com.atstudy.headline.web.admin.service.AdPerformanceDailyService;
import com.atstudy.headline.web.admin.vo.ad.AdPerDailyVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin/adPerformanceDaily")
public class adPerformanceDailyController {

    @Autowired
    private AdPerformanceDailyService adPerformanceDailyService;

    @Autowired
    private AdAudienceStatsService adAudienceStatsService;

    /**
     * 分页查询用户行为数据
     * @param current 当前页码
     * @param size 每页大小
     * @param queryVo 查询条件
     * @return 分页结果
     */
    @GetMapping("/daily/page")
    public Result<IPage<AdPerformanceDaily>> pageUserBehaviorDaily(
            @RequestParam(defaultValue = "1") Integer current,
            @RequestParam(defaultValue = "6") Integer size,
            AdPerDailyVo queryVo) {
        Page<AdPerformanceDaily> page = new Page<>(current, size);
        IPage<AdPerformanceDaily> AdPerformanceDailyIPage = adPerformanceDailyService.pageInfoByAdPerDaily(page, queryVo);
        return Result.ok(AdPerformanceDailyIPage);
    }
}